package packets;

import java.util.ArrayList;
import java.util.List;

import org.jnetpcap.packet.JHeader;
import org.jnetpcap.packet.JPacket;
import org.jnetpcap.packet.annotate.Bind;

public class OSPFAcknowledgement extends JHeader {
	
	private List<LSA> lsaList;
	
	public List<LSA> getLSAs(){
		return this.lsaList;
	}
	
	
	@Bind(to = OSPF.class)
	public static boolean bindToOSPF(JPacket packet, OSPF ospf){
		return ospf.type() == 0x05;
	}
	
	@Override
	protected void decodeHeader() {
		int offsetIntoHeader = 0;
		int lsaCount = (this.size() - 0) / 20;
		List<LSA> lsas = new ArrayList<LSA>();
		lsaList = lsas;
		for(int i=0; i<lsaCount; i++){
			LSA tempLSA = new LSA();
			tempLSA.peer(this, 0+(i*20), 20);
			lsas.add(tempLSA);
		}
	}

}
